Skip to content

feat(docs-tools): maximize code-evidence usage across all workflow steps#137

Merged
DonaghBr merged 1 commit intoredhat-documentation:mainfrom
DonaghBr:improve-code-evidence
May 1, 2026
Merged

feat(docs-tools): maximize code-evidence usage across all workflow steps#137
DonaghBr merged 1 commit intoredhat-documentation:mainfrom
DonaghBr:improve-code-evidence

Conversation

@DonaghBr
Copy link
Copy Markdown
Collaborator

@DonaghBr DonaghBr commented Apr 30, 2026

Summary

  • Extend code-evidence grounding from 2 of 7 steps (scope-req-audit, code-evidence) to all steps that benefit from it — requirements, planning, writing, and technical review now use code evidence when a source repo is available
  • Add grounded_review.py and api_surface.py to the technical review step as a pre-scan, giving the reviewer concrete code verdicts instead of relying solely on engineering judgment
  • Add anti-fabrication guardrails to the writing step: evidence-status classifications drive [NEEDS VERIFICATION] markers for partial requirements and skip absent ones
  • Code-evidence workflow supports JIRA auto-discovery — no longer requires explicit --source-code-repo (but hard-stops if no repo is found from any source)

Changes by step

# Step Change
1 Technical review grounded_review.py + api_surface.py pre-scan; pass verdicts to technical-reviewer agent
2 Writing Pass evidence-status.json, source repo path; per-requirement fabrication guardrails
3 Code-evidence Run api_surface.py, seed queries from scope-req-audit key_files
4 Requirements requirements-analyst verifies features in code, identifies existing docs, extracts metadata
5 Planning Planner references key_files as content source pointers in module specs
6 Scope-req-audit Multi-query classification (2-3 reformulations), API surface cross-check

Depends on

Test plan

  • Run docs-orchestrator RHAISTRAT-1084 --workflow code-evidence --source-code-repo https://github.com/opendatahub-io/model-registry --docs-repo-path <docs-fork> and verify each step's output
  • Verify build_writing_args.sh emits evidence_status, has_evidence_status, source_repo fields (unit test passes)
  • Verify code-evidence workflow without --source-code-repo attempts JIRA auto-discovery and fails with clear message if no repo found
  • Verify default workflow (no code-evidence) is unaffected — tech review skips grounded pre-scan, writer skips evidence-status paragraphs
  • Compare output quality against baseline (same ticket, same repo, pre-improvement branch)

Made with Claude Opus 4.6

Summary by CodeRabbit

  • New Features

    • Code-grounded evidence validation and API-surface extraction integrated across documentation workflows
    • Optional repository-aware enrichment to surface implementation evidence, docs, and code references
    • Evidence-status tracking and consumption added to writing/import flows; new import mode supported
    • Multi-query web search for evidence with selection of highest-confidence results
  • Documentation

    • Updated workflow docs, step descriptions, and output examples to reflect repo-aware, code-grounded behavior

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Warning

Rate limit exceeded

@DonaghBr has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 40 minutes and 59 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: aa2409f1-eafc-427b-a14f-e1f87fec250e

📥 Commits

Reviewing files that changed from the base of the PR and between 034ab62 and 4cc3c62.

📒 Files selected for processing (14)
  • plugins/docs-tools/.claude-plugin/plugin.json
  • plugins/docs-tools/agents/evidence-classifier.md
  • plugins/docs-tools/agents/requirements-analyst.md
  • plugins/docs-tools/skills/docs-orchestrator/SKILL.md
  • plugins/docs-tools/skills/docs-orchestrator/defaults/docs-workflow-code-evidence.yaml
  • plugins/docs-tools/skills/docs-orchestrator/schema/step-result-schema.md
  • plugins/docs-tools/skills/docs-workflow-code-evidence/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-planning/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-scope-req-audit/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-writing/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh
  • scripts/test-upstream-plugin.sh

Walkthrough

Updates documentation and configs to add repo-aware enrichment, multi-query evidence classification with optional API-surface cross-checking, API-surface extraction in pre-flight, and new artifacts/flags for code-grounded technical review. Agent turn limit increased from 8 to 10.

Changes

Cohort / File(s) Summary
Agent prompts & classifiers
plugins/docs-tools/agents/evidence-classifier.md, plugins/docs-tools/agents/requirements-analyst.md
Increased maxTurns from 8→10. Evidence-classifier now generates 2–3 reformulated NL queries, selects best result by top_score, and optionally cross-checks results against API_SURFACE_FILE to treat exact API matches as grounded. requirements-analyst.md accepts optional REPO_PATH to perform repo reads, detect docs, extract metadata, and annotate references with "type":"code".
Orchestrator & workflow docs
plugins/docs-tools/skills/docs-orchestrator/SKILL.md, plugins/docs-tools/skills/docs-orchestrator/defaults/docs-workflow-code-evidence.yaml
Propagates --source-code-repo to technical-review via --repo; updates code-evidence workflow description and repo resolution/stop semantics.
Workflow artifacts & steps
plugins/docs-tools/skills/docs-workflow-code-evidence/SKILL.md, plugins/docs-tools/skills/docs-workflow-planning/SKILL.md, plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md, plugins/docs-tools/skills/docs-workflow-scope-req-audit/SKILL.md
Adds api-surface.json artifact; Step for running api_surface.py and seeding directory-scoped queries; requires inclusion of key_files for grounded/partial requirement prompts; scope-audit pre-flight runs api_surface.py and propagates API_SURFACE_FILE to subagents.
Technical review & schema
plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md, plugins/docs-tools/skills/docs-orchestrator/schema/step-result-schema.md
Tech-review accepts --repo and inserts conditional code-grounded pre-scan (runs grounded_review.py, api_surface.py), emits grounded-review.json/api-surface.json, and documents new code_grounded: boolean in step-result schema.
Writing workflow & CLI script
plugins/docs-tools/skills/docs-workflow-writing/SKILL.md, plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh
Adds --import-from and --repo CLI options; script validates --repo, detects scope-req-audit/evidence-status.json, and emits evidence_status, has_evidence_status, and import_from fields. Writer prompts updated to conditionally consume evidence classifications and restrict repo reads to specific files.
Documentation / messaging edits
multiple SKILL.md files and workflow docs (.../SKILL.md)
Various prompt, step-numbering, and messaging updates to reflect new repo-aware flows, step renumbering, and failure/remediation guidance.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Requirement Agent
    participant NLSearch as Natural-Language Search
    participant APISurf as API Surface Artifact
    participant Classifier as Evidence Classifier

    Client->>Classifier: submit requirement (+ optional API_SURFACE_FILE)
    Classifier->>NLSearch: run Query A (implementation-focused)
    NLSearch-->>Classifier: results A (top_score)
    Classifier->>NLSearch: run Query B (term-focused)
    NLSearch-->>Classifier: results B (top_score)
    Classifier->>NLSearch: optional Query C (alternate phrasing)
    NLSearch-->>Classifier: results C (top_score)
    Classifier->>Classifier: select best result by top_score

    alt API_SURFACE_FILE provided
        Classifier->>APISurf: cross-check selected results vs API entities
        APISurf-->>Classifier: exact match?
        Classifier->>Classifier: if exact -> set top_score >= grounded threshold
    end

    Classifier-->>Client: return evidence classification + top_score
Loading
sequenceDiagram
    participant ReqAgent as Requirements Analyst
    participant RepoReader as Repo Reader
    participant WebSearch as Web Search
    participant Merger as Evidence Merger

    ReqAgent->>RepoReader: REPO_PATH present?
    alt REPO_PATH provided
        RepoReader->>RepoReader: read/glob/grep codebase
        RepoReader-->>ReqAgent: code references, README/CHANGELOG/docs, repo_metadata
    end
    ReqAgent->>WebSearch: web search (step 3)
    WebSearch-->>ReqAgent: web results
    ReqAgent->>Merger: merge repo + web evidence into references
    Merger-->>ReqAgent: enriched requirement output
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • aireilly

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Skill And Script Conventions ❌ Error Pull request contains old slash-command syntax and unnecessary plugin-prefixed skill names violating documented conventions. Replace plugin-prefixed skill names with bare names and remove or mark slash-command syntax as deprecated.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main objective of the changeset: extending code-evidence grounding across multiple workflow steps (requirements, planning, writing, technical review) to maximize repository utilization.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No Real People Names In Style References ✅ Passed The pull request contains no references to real people by name used as style references, in plugin commands, or in example prompts. The only person name found (Gabriel McGoldrick) is a legitimate author attribution in metadata.
Git Safety Rules ✅ Passed No git commands, push operations, or git safety violations found in changed files.
No Untrusted Mcp Servers ✅ Passed The pull request does not introduce any MCP server installations from untrusted sources. New dependencies are limited to legitimate Anthropic libraries.
Plugin Registry Consistency ✅ Passed PR does not modify plugin.json files; all changes are enhancements to existing agents and skills with no overlapping functionality.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 40 minutes and 59 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (4)
plugins/docs-tools/skills/docs-orchestrator/scripts/resolve_source.py (1)

355-368: ⚡ Quick win

Silent exception handling loses diagnostic information.

When jira_reader.py fails due to JSONDecodeError, TimeoutExpired, or IndexError, the exceptions are silently swallowed. This makes debugging difficult when JIRA discovery unexpectedly returns no results despite the ticket having git links.

Consider logging a warning to stderr before the pass:

🔧 Proposed fix to add warning on failure
     except (json.JSONDecodeError, subprocess.TimeoutExpired, IndexError):
-        pass
+        print(f"WARNING: Failed to fetch git_links from JIRA ticket {ticket}", file=sys.stderr)

And similarly for the --graph call at line 382-383.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/docs-tools/skills/docs-orchestrator/scripts/resolve_source.py` around
lines 355 - 368, The try/except around the subprocess.run call that invokes
jira_reader (the ["python3", str(jira_script), "--issue", ticket] invocation)
silently swallows JSONDecodeError, subprocess.TimeoutExpired, and IndexError;
modify the except to capture the exception as e and write a concise warning
including the ticket, jira_script, and exception details to stderr (or via
logging) before continuing so failures are visible; apply the same change to the
parallel subprocess.run that calls jira_reader with the "--graph" flag (the
other run invocation) so both failure paths emit diagnostic warnings rather than
silently passing.
plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md (1)

50-65: 💤 Low value

Add language specifier to Agent pseudocode block.

Static analysis flagged missing language specifier. Since this is pseudocode for the Agent tool invocation pattern, consider using a generic specifier or adding a comment.

📝 Suggested fix
-```
+```yaml
 Agent:
   subagent_type: docs-tools:requirements-discoverer
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md` around lines
50 - 65, Update the fenced pseudocode block for the Agent invocation to include
a language specifier (e.g., change the opening fence from ``` to ```yaml) so
static analysis recognizes the block as YAML; specifically modify the block that
begins with "Agent:" and contains "subagent_type:
docs-tools:requirements-discoverer" to use a language tag (or add a brief inline
comment) while preserving the existing keys and prompt content.
plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md (1)

27-39: 💤 Low value

Minor: Add language specifiers to fenced code blocks.

Static analysis flagged missing language specifiers on the code blocks at lines 27 and 34. This is a minor documentation hygiene issue.

📝 Suggested fix
 ## Input

-```
+```text
 <base-path>/writing/
 <repo-path>/ (optional — source code repo for code-grounded validation)

Output

- +text
/technical-review/review.md

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md around lines 27

  • 39, The fenced code blocks containing "/writing/ ... /"
    and the "## Output" block (e.g., lines showing
    "/technical-review/review.md", "step-result.json", etc.) in SKILL.md
    are missing language specifiers; update both triple-backtick fences to include a
    language (use "text") so they become text ... to satisfy static analysis
    and documentation hygiene.

</details>

</blockquote></details>
<details>
<summary>plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh (1)</summary><blockquote>

`26-26`: _💤 Low value_

**`IMPORT_FROM` is initialized but never assigned a value.**

The variable is set to empty string on line 26 and emitted as `null` in the JSON output (line 201), but there's no CLI flag or logic to populate it. If this is intentional scaffolding for a future `--import-from` flag, consider adding a comment. Otherwise, remove the dead variable.

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
Verify each finding against the current code and only fix it if needed.

In
`@plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh`
at line 26, The variable IMPORT_FROM in build_writing_args.sh is defined as an
empty string but never set or wired to a CLI flag, causing it to emit null in
the generated JSON; either remove the unused IMPORT_FROM variable and any
references to it in the JSON-building logic, or implement a CLI flag/assignment
to populate it (e.g., add parsing for a --import-from option and assign to
IMPORT_FROM before the JSON is produced). Update the JSON emission code that
currently references IMPORT_FROM so it only includes the field when the variable
is non-empty, or remove that field entirely if you choose to delete IMPORT_FROM.
```

</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Inline comments:
In @plugins/docs-tools/agents/evidence-classifier.md:

  • Around line 45-77: The classification incorrectly treats empty NL results as
    Absent before honoring exact API-surface matches; update the logic that handles
    API_SURFACE_FILE and top_score so an exact API surface entity match immediately
    sets top_score (or a flag) to at least GROUNDED_THRESHOLD and bypasses the
    "empty NL result => Absent" check; ensure the classifier evaluates API-surface
    matches prior to the absent-rule and that the subsequent classification uses
    top_score, GROUNDED_THRESHOLD, and ABSENT_THRESHOLD (and the count of results
    above ABSENT_THRESHOLD) to decide Grounded/Partial/Absent per the described
    order.

In @plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md:

  • Line 4: Update the SKILL.md metadata so the argument-hint includes the
    undocumented --repo flag; specifically edit the argument-hint key (currently
    "argument-hint: --base-path [--pr ]...") to add "[--repo
    <repo_path>]" (or similar name used elsewhere) so it matches references to
    --repo on lines that call this step (see references to --repo on lines 105 and
    113); ensure the hint syntax matches the orchestrator docs' "[--pr ]...
    [--repo <repo_path>]" pattern.

In @plugins/docs-tools/skills/docs-workflow-writing/SKILL.md:

  • Around line 24-49: The JSON example contains duplicate keys (e.g., "mode",
    "ticket", "format", "input_file", "evidence_file", "has_evidence", "output_dir",
    "output_file") causing confusion; remove the first duplicated block and keep the
    consolidated schema that includes the extended fields ("evidence_status",
    "has_evidence_status", "source_repo", "repo_path", "fix_from", "import_from",
    "verify_output"), ensuring only one occurrence of each key in the JSON example
    so readers see the final, authoritative schema.

In @scripts/test-upstream-plugin.sh:

  • Around line 122-130: The branch detection currently uses the caller's CWD;
    update the logic to detect the branch from the marketplace repo by running git
    in MARKETPLACE_DIR (e.g., git -C "$MARKETPLACE_DIR" branch --show-current or
    pushd/popd into MARKETPLACE_DIR) when $branch is empty, and ensure
    MARKETPLACE_DIR exists and is a git repository before any git commands by
    checking [[ -d "$MARKETPLACE_DIR" ]] and [[ -d "$MARKETPLACE_DIR/.git" ]] (or
    git -C "$MARKETPLACE_DIR" rev-parse --is-inside-work-tree) and fail with a clear
    error if not; modify the block that sets branch (the branch variable resolution)
    and any subsequent git operations that rely on MARKETPLACE_DIR to use the
    validated path (or git -C) so fetch/checkout operate on the marketplace repo,
    not the caller's CWD.
  • Around line 83-90: The --branch and --plugin case arms currently read $2
    directly which can trigger an unbound-variable exit under set -u when the option
    value is omitted; update the case branches in the while loop handling to
    validate there is a next argument (e.g., check that $# -ge 2 or test ${2:-} is
    non-empty) before assigning branch="$2" or plugin="$2", and if the value is
    missing call usage (or print an error) and exit instead of reading an unset
    variable; reference the while loop and the case arms for --branch/--plugin and
    the variables branch, plugin, and usage when making the change.

Nitpick comments:
In @plugins/docs-tools/skills/docs-orchestrator/scripts/resolve_source.py:

  • Around line 355-368: The try/except around the subprocess.run call that
    invokes jira_reader (the ["python3", str(jira_script), "--issue", ticket]
    invocation) silently swallows JSONDecodeError, subprocess.TimeoutExpired, and
    IndexError; modify the except to capture the exception as e and write a concise
    warning including the ticket, jira_script, and exception details to stderr (or
    via logging) before continuing so failures are visible; apply the same change to
    the parallel subprocess.run that calls jira_reader with the "--graph" flag (the
    other run invocation) so both failure paths emit diagnostic warnings rather than
    silently passing.

In @plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md:

  • Around line 50-65: Update the fenced pseudocode block for the Agent invocation
    to include a language specifier (e.g., change the opening fence from ``` to
the block that begins with "Agent:" and contains "subagent_type:
docs-tools:requirements-discoverer" to use a language tag (or add a brief inline
comment) while preserving the existing keys and prompt content.

In `@plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md`:
- Around line 27-39: The fenced code blocks containing "<base-path>/writing/ ...
<repo-path>/" and the "## Output" block (e.g., lines showing
"<base-path>/technical-review/review.md", "step-result.json", etc.) in SKILL.md
are missing language specifiers; update both triple-backtick fences to include a
language (use "text") so they become ```text ... ``` to satisfy static analysis
and documentation hygiene.

In
`@plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh`:
- Line 26: The variable IMPORT_FROM in build_writing_args.sh is defined as an
empty string but never set or wired to a CLI flag, causing it to emit null in
the generated JSON; either remove the unused IMPORT_FROM variable and any
references to it in the JSON-building logic, or implement a CLI flag/assignment
to populate it (e.g., add parsing for a --import-from option and assign to
IMPORT_FROM before the JSON is produced). Update the JSON emission code that
currently references IMPORT_FROM so it only includes the field when the variable
is non-empty, or remove that field entirely if you choose to delete IMPORT_FROM.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f797efd1-67e4-4877-91f5-6080c61f1265

📥 Commits

Reviewing files that changed from the base of the PR and between e2ac6b0 and 189f012.

📒 Files selected for processing (19)
  • plugins/docs-tools/.claude-plugin/plugin.json
  • plugins/docs-tools/agents/evidence-classifier.md
  • plugins/docs-tools/agents/requirements-analyst.md
  • plugins/docs-tools/agents/requirements-discoverer.md
  • plugins/docs-tools/skills/docs-orchestrator/SKILL.md
  • plugins/docs-tools/skills/docs-orchestrator/defaults/docs-workflow-code-evidence.yaml
  • plugins/docs-tools/skills/docs-orchestrator/schema/step-result-schema.md
  • plugins/docs-tools/skills/docs-orchestrator/scripts/resolve_source.py
  • plugins/docs-tools/skills/docs-workflow-code-evidence/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-planning/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-scope-req-audit/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-start/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-style-review/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-writing/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh
  • scripts/test-upstream-plugin.sh
  • scripts/toggle-plugin-dev.sh
💤 Files with no reviewable changes (1)
  • scripts/toggle-plugin-dev.sh

Comment thread plugins/docs-tools/agents/evidence-classifier.md
Comment thread plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md
Comment thread plugins/docs-tools/skills/docs-workflow-writing/SKILL.md
Comment thread scripts/test-upstream-plugin.sh
Comment thread scripts/test-upstream-plugin.sh
@DonaghBr DonaghBr force-pushed the improve-code-evidence branch 2 times, most recently from f737820 to c6792fe Compare May 1, 2026 07:02
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md (1)

4-4: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

The --repo flag remains undocumented in the argument-hint.

Lines 105 and 113 reference --repo being passed to this step, but the argument-hint on line 4 only shows [--pr <url>].... The orchestrator documentation confirms requirements receives [--pr <url>]... [--repo <repo_path>].

📝 Suggested fix
-argument-hint: <ticket> --base-path <path> [--pr <url>]...
+argument-hint: <ticket> --base-path <path> [--pr <url>]... [--repo <path>]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md` at line 4, The
argument-hint entry is missing the --repo flag referenced elsewhere; update the
argument-hint string (the line starting with "argument-hint:") to include
[--repo <repo_path>] alongside [--pr <url>] so it reads something like:
argument-hint: <ticket> --base-path <path> [--pr <url>]... [--repo <repo_path>],
ensuring the documented CLI signature matches the uses of --repo in the SKILL.md
content.
🧹 Nitpick comments (1)
plugins/docs-tools/skills/docs-workflow-scope-req-audit/SKILL.md (1)

152-152: 💤 Low value

Clarify the conditional inclusion of API_SURFACE_FILE.

The instruction says "or omit this line if empty" but shows the line in the agent prompt template. Consider making it explicit: when API_SURFACE_FILE="", omit the entire line from the prompt rather than including - API_SURFACE_FILE: with no value.

✍️ Suggested clarification
     - REPO_PATH: <absolute repo path>
     - GROUNDED_THRESHOLD: <threshold>
     - ABSENT_THRESHOLD: <threshold>
-    - API_SURFACE_FILE: <API_SURFACE_FILE or omit this line if empty>
+    [Include only if API_SURFACE_FILE is not empty:]
+    - API_SURFACE_FILE: <API_SURFACE_FILE>

Or more explicitly in the prose:

If API_SURFACE_FILE is not empty, add:
    - API_SURFACE_FILE: <path>
Otherwise, omit this line entirely.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/docs-tools/skills/docs-workflow-scope-req-audit/SKILL.md` at line
152, Update the SKILL.md prompt template text to explicitly state the
conditional behavior for API_SURFACE_FILE: when API_SURFACE_FILE is non-empty
include the line "- API_SURFACE_FILE: <path>", and when API_SURFACE_FILE == ""
omit the entire "- API_SURFACE_FILE:" line; reference the API_SURFACE_FILE token
in the prose so readers and any template-rendering code know to remove the line
rather than render an empty value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/docs-tools/agents/requirements-analyst.md`:
- Line 77: The "first requirement" guard that skips repo metadata extraction
based on RELATED_TICKETS is racy in the fan-out architecture; remove that
conditional in the requirements-analyst logic so each agent always produces a
repo_metadata field (the requirements skill/orchestrator will deduplicate during
merge), or alternatively move the extraction out of requirements-analyst into
the single-run requirements-discoverer component so metadata is produced exactly
once; update the code paths that reference RELATED_TICKETS and repo_metadata to
reflect the chosen approach.

In `@plugins/docs-tools/skills/docs-workflow-code-evidence/SKILL.md`:
- Around line 217-233: The doc must explicitly describe reading
`${OUTPUT_DIR}/api-surface.json`, parsing the existing `$EVIDENCE_FILE` JSON,
adding an `api_surface` property whose value is the parsed API surface object,
and writing the modified JSON back to `$EVIDENCE_FILE`; update the SKILL.md text
around the mention of `api-surface.json` and `$EVIDENCE_FILE` to show the three
steps (read API surface, read/parse evidence.json, merge/append `api_surface`,
write back) and give a concrete command example using `jq` (or equivalent)
referencing `api-surface.json`, `$EVIDENCE_FILE`, and the `api_surface` field so
readers can implement the multi-step modification reliably.

In `@plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md`:
- Line 119: The review text references API_SURFACE_FILE even when api_surface
extraction failed; update the logic to check HAS_API_SURFACE before emitting the
"Cross-reference the API surface at <API_SURFACE_FILE>" instruction—mirror the
pattern used for the HAS_GROUNDED check (wrap the instruction in a conditional
that only outputs the API surface guidance when HAS_API_SURFACE=true), using the
HAS_API_SURFACE variable and API_SURFACE_FILE symbol to locate and guard that
block.

---

Duplicate comments:
In `@plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md`:
- Line 4: The argument-hint entry is missing the --repo flag referenced
elsewhere; update the argument-hint string (the line starting with
"argument-hint:") to include [--repo <repo_path>] alongside [--pr <url>] so it
reads something like: argument-hint: <ticket> --base-path <path> [--pr <url>]...
[--repo <repo_path>], ensuring the documented CLI signature matches the uses of
--repo in the SKILL.md content.

---

Nitpick comments:
In `@plugins/docs-tools/skills/docs-workflow-scope-req-audit/SKILL.md`:
- Line 152: Update the SKILL.md prompt template text to explicitly state the
conditional behavior for API_SURFACE_FILE: when API_SURFACE_FILE is non-empty
include the line "- API_SURFACE_FILE: <path>", and when API_SURFACE_FILE == ""
omit the entire "- API_SURFACE_FILE:" line; reference the API_SURFACE_FILE token
in the prose so readers and any template-rendering code know to remove the line
rather than render an empty value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 36ebe346-b545-4530-9a71-61638824b7c9

📥 Commits

Reviewing files that changed from the base of the PR and between 189f012 and f737820.

📒 Files selected for processing (12)
  • plugins/docs-tools/agents/evidence-classifier.md
  • plugins/docs-tools/agents/requirements-analyst.md
  • plugins/docs-tools/skills/docs-orchestrator/SKILL.md
  • plugins/docs-tools/skills/docs-orchestrator/defaults/docs-workflow-code-evidence.yaml
  • plugins/docs-tools/skills/docs-orchestrator/schema/step-result-schema.md
  • plugins/docs-tools/skills/docs-workflow-code-evidence/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-planning/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-scope-req-audit/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-writing/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh
✅ Files skipped from review due to trivial changes (1)
  • plugins/docs-tools/skills/docs-orchestrator/defaults/docs-workflow-code-evidence.yaml
🚧 Files skipped from review as they are similar to previous changes (5)
  • plugins/docs-tools/skills/docs-workflow-planning/SKILL.md
  • plugins/docs-tools/skills/docs-orchestrator/schema/step-result-schema.md
  • plugins/docs-tools/skills/docs-workflow-writing/SKILL.md
  • plugins/docs-tools/agents/evidence-classifier.md
  • plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh

Comment thread plugins/docs-tools/agents/requirements-analyst.md Outdated
Comment thread plugins/docs-tools/skills/docs-workflow-code-evidence/SKILL.md
Comment thread plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md
@DonaghBr DonaghBr force-pushed the improve-code-evidence branch from c6792fe to 034ab62 Compare May 1, 2026 16:42
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh (1)

37-87: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Wire --import-from through the parser before exporting import_from.

The script now publishes an import_from field, but there is no --import-from case in the CLI parser, so the value is always null and the new import contract cannot actually be reached. Either add the missing flag handling here or remove the field until import mode is implemented.

Also applies to: 175-208

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh`
around lines 37 - 87, The parser is missing handling for the --import-from flag
so the exported import_from is always null; add a case in the argument-parsing
loop to accept --import-from by calling require_arg "$1" "${2:-}", assign
IMPORT_FROM="$2", and shift 2 (mirror the pattern used for
--repo/--base-path/--format), and ensure the variable used when exporting
import_from later references IMPORT_FROM; also apply the same addition in the
second parsing block around lines 175-208 where duplicated parsing occurs so
both code paths populate IMPORT_FROM consistently.
plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md (1)

40-155: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Move the pre-scan out of SKILL.md.

This block is doing argument handling, path setup, file discovery, command selection, and output wiring inline. That conflicts with the repo rule that docs-workflow step skills should keep procedural logic in skills/<skill-name>/scripts/ and leave SKILL.md declarative. Based on learnings: step skills must defer argument parsing, mode determination, input validation, path computation, and directory creation to a script.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md` around lines 40
- 155, The SKILL.md contains procedural pre-scan logic (argument parsing, path
setup, HAS_REPO/HAS_GROUNDED/HAS_API_SURFACE flags, DRAFTS_DIR,
OUTPUT_DIR/GROUNDED_FILE/API_SURFACE_FILE generation, drafts-batch.json
creation, and invoking grounded_review.py and api_surface.py) that must be moved
into a script; extract all runtime logic into a new script under
skills/docs-workflow-tech-review/scripts/ (e.g., pre_scan.sh or pre_scan.py)
that accepts the ticket ID, --base-path, and optional --repo and performs:
argument parsing, directory creation, mode detection (reading
writing/step-result.json and _index.md), building drafts-batch.json, invoking
grounded_review.py and api_surface.py with the same flags and setting
HAS_GROUNDED/HAS_API_SURFACE, and writing GROUNDED_FILE/API_SURFACE_FILE and
CODE_EVIDENCE_SUMMARY; then replace the SKILL.md block with a short declarative
description that calls the script and documents its outputs (GROUNDED_FILE,
API_SURFACE_FILE, CODE_EVIDENCE_SUMMARY) without inline shell logic.
♻️ Duplicate comments (1)
plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md (1)

173-194: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Guard the API-surface reference on HAS_API_SURFACE too.

<API_SURFACE_FILE> is still mentioned whenever HAS_GROUNDED=true, even if API extraction failed. That can send the reviewer to a file that does not exist and makes the fallback path inconsistent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md` around lines
173 - 194, The SKILL.md grounded-review block currently always mentions
<API_SURFACE_FILE> when HAS_GROUNDED is true; update the template to only
include or reference <API_SURFACE_FILE> when HAS_API_SURFACE is true as well
(i.e., guard the API surface cross-reference behind both HAS_GROUNDED and
HAS_API_SURFACE), so modify the conditional logic that renders the
"Cross-reference the API surface at `<API_SURFACE_FILE>`" line to check
HAS_API_SURFACE before inserting <API_SURFACE_FILE>; ensure related symbols in
the block such as HAS_REPO, HAS_GROUNDED, GROUNDED_FILE, and
CODE_EVIDENCE_SUMMARY remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/docs-tools/skills/docs-workflow-writing/SKILL.md`:
- Around line 24-42: The SKILL contract advertises mode: import and import_from
but no implementation exists; either implement an import execution branch or
remove it from the public schema. If you implement it, add an "import" branch in
the skill dispatcher (the code path that switches on the mode), implement a
handler (e.g., handleImport / execute import branch) that consumes import_from,
defines prompt and placement rules consistent with other modes (use the same
buildPrompt/placement logic), and wire verify_output/has_evidence handling for
imports; otherwise remove "import" and "import_from" from the SKILL JSON block
and any related validation so callers cannot request a non-existent mode. Ensure
references to "mode" and "import_from" in the dispatcher, prompt generation, and
validation are kept consistent.

---

Outside diff comments:
In `@plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md`:
- Around line 40-155: The SKILL.md contains procedural pre-scan logic (argument
parsing, path setup, HAS_REPO/HAS_GROUNDED/HAS_API_SURFACE flags, DRAFTS_DIR,
OUTPUT_DIR/GROUNDED_FILE/API_SURFACE_FILE generation, drafts-batch.json
creation, and invoking grounded_review.py and api_surface.py) that must be moved
into a script; extract all runtime logic into a new script under
skills/docs-workflow-tech-review/scripts/ (e.g., pre_scan.sh or pre_scan.py)
that accepts the ticket ID, --base-path, and optional --repo and performs:
argument parsing, directory creation, mode detection (reading
writing/step-result.json and _index.md), building drafts-batch.json, invoking
grounded_review.py and api_surface.py with the same flags and setting
HAS_GROUNDED/HAS_API_SURFACE, and writing GROUNDED_FILE/API_SURFACE_FILE and
CODE_EVIDENCE_SUMMARY; then replace the SKILL.md block with a short declarative
description that calls the script and documents its outputs (GROUNDED_FILE,
API_SURFACE_FILE, CODE_EVIDENCE_SUMMARY) without inline shell logic.

In
`@plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh`:
- Around line 37-87: The parser is missing handling for the --import-from flag
so the exported import_from is always null; add a case in the argument-parsing
loop to accept --import-from by calling require_arg "$1" "${2:-}", assign
IMPORT_FROM="$2", and shift 2 (mirror the pattern used for
--repo/--base-path/--format), and ensure the variable used when exporting
import_from later references IMPORT_FROM; also apply the same addition in the
second parsing block around lines 175-208 where duplicated parsing occurs so
both code paths populate IMPORT_FROM consistently.

---

Duplicate comments:
In `@plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md`:
- Around line 173-194: The SKILL.md grounded-review block currently always
mentions <API_SURFACE_FILE> when HAS_GROUNDED is true; update the template to
only include or reference <API_SURFACE_FILE> when HAS_API_SURFACE is true as
well (i.e., guard the API surface cross-reference behind both HAS_GROUNDED and
HAS_API_SURFACE), so modify the conditional logic that renders the
"Cross-reference the API surface at `<API_SURFACE_FILE>`" line to check
HAS_API_SURFACE before inserting <API_SURFACE_FILE>; ensure related symbols in
the block such as HAS_REPO, HAS_GROUNDED, GROUNDED_FILE, and
CODE_EVIDENCE_SUMMARY remain unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fd9b107b-e37e-442d-b88b-b24b750ad346

📥 Commits

Reviewing files that changed from the base of the PR and between f737820 and 034ab62.

📒 Files selected for processing (12)
  • plugins/docs-tools/agents/evidence-classifier.md
  • plugins/docs-tools/agents/requirements-analyst.md
  • plugins/docs-tools/skills/docs-orchestrator/SKILL.md
  • plugins/docs-tools/skills/docs-orchestrator/defaults/docs-workflow-code-evidence.yaml
  • plugins/docs-tools/skills/docs-orchestrator/schema/step-result-schema.md
  • plugins/docs-tools/skills/docs-workflow-code-evidence/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-planning/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-scope-req-audit/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-tech-review/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-writing/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-writing/scripts/build_writing_args.sh
✅ Files skipped from review due to trivial changes (4)
  • plugins/docs-tools/skills/docs-orchestrator/defaults/docs-workflow-code-evidence.yaml
  • plugins/docs-tools/skills/docs-workflow-requirements/SKILL.md
  • plugins/docs-tools/agents/requirements-analyst.md
  • plugins/docs-tools/skills/docs-workflow-code-evidence/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • plugins/docs-tools/skills/docs-orchestrator/schema/step-result-schema.md
  • plugins/docs-tools/skills/docs-workflow-planning/SKILL.md
  • plugins/docs-tools/skills/docs-workflow-scope-req-audit/SKILL.md
  • plugins/docs-tools/agents/evidence-classifier.md

Comment on lines 24 to 42
```json
{
"mode": "update-in-place | draft | fix",
"ticket": "PROJ-123",
"format": "adoc | mkdocs",
"input_file": "<base-path>/planning/plan.md",
"evidence_file": "<base-path>/code-evidence/evidence.json | null",
"has_evidence": true | false,
"output_dir": "<base-path>/writing",
"output_file": "<base-path>/writing/_index.md",
"docs_repo_path": "<path> | null",
"source_repo_path": "<path> | null",
"fix_from": "<path> | null",
"verify_output": true | false
"mode": "update-in-place | draft | fix | import",
"ticket": "PROJ-123",
"format": "adoc | mkdocs",
"input_file": "<base-path>/planning/plan.md",
"evidence_file": "<base-path>/code-evidence/evidence.json | null",
"has_evidence": true | false,
"evidence_status": "<base-path>/scope-req-audit/evidence-status.json | null",
"has_evidence_status": true | false,
"output_dir": "<base-path>/writing",
"output_file": "<base-path>/writing/_index.md",
"docs_repo_path": "<path> | null",
"source_repo_path": "<path> | null",
"fix_from": "<path> | null",
"import_from": "<path> | null",
"verify_output": true | false
}
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add an import execution branch or drop it from the public contract.

The JSON schema now advertises mode: import and import_from, but the rest of the skill never defines import behavior. As written, callers can request a mode that has no prompt/placement rules, so the contract and dispatcher will diverge.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/docs-tools/skills/docs-workflow-writing/SKILL.md` around lines 24 -
42, The SKILL contract advertises mode: import and import_from but no
implementation exists; either implement an import execution branch or remove it
from the public schema. If you implement it, add an "import" branch in the skill
dispatcher (the code path that switches on the mode), implement a handler (e.g.,
handleImport / execute import branch) that consumes import_from, defines prompt
and placement rules consistent with other modes (use the same
buildPrompt/placement logic), and wire verify_output/has_evidence handling for
imports; otherwise remove "import" and "import_from" from the SKILL JSON block
and any related validation so callers cannot request a non-existent mode. Ensure
references to "mode" and "import_from" in the dispatcher, prompt generation, and
validation are kept consistent.

@DonaghBr DonaghBr force-pushed the improve-code-evidence branch 2 times, most recently from ba80223 to 2f9a0f3 Compare May 1, 2026 16:59
Extend code-evidence grounding from 2 of 7 steps to all steps that
benefit from it. The repo is already cloned and indexed — these changes
make every step smarter about using that evidence.

Changes by step:

1. Technical review: run grounded_review.py and api_surface.py as a
   pre-scan when source repo is available. Pass verdicts to the
   technical-reviewer agent as pre-computed evidence.

2. Writing: pass evidence-status.json (grounded/partial/absent per
   requirement), source repo path, and anti-fabrication guardrails.
   Writer uses [NEEDS VERIFICATION] for partial requirements, skips
   absent ones.

3. Code-evidence step: run api_surface.py alongside find_evidence.py
   and include API surface in evidence.json. Seed additional queries
   from scope-req-audit key_files for better retrieval quality.

4. Requirements: requirements-analyst verifies features exist in code,
   identifies existing docs, extracts project metadata, and notes code
   references when repo is available.

5. Planning: planner references key_files from evidence-status as
   content source pointers in module specifications.

6. Scope-req-audit: evidence-classifier uses 2-3 query reformulations
   to reduce false-absent classifications. API surface extracted in
   pre-flight and passed to classifiers as supplementary evidence.

Also: code-evidence workflow no longer hard-fails without explicit
--source-code-repo. Pre-flight attempts JIRA auto-discovery first,
then fails with clear actionable options if no repo is found.

Made-with: Cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
@DonaghBr DonaghBr force-pushed the improve-code-evidence branch from 2f9a0f3 to 4cc3c62 Compare May 1, 2026 17:01
@DonaghBr DonaghBr merged commit d3635aa into redhat-documentation:main May 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant